package com.bd.scm.module.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bd.scm.dao.mapper.user.UserInfoMapper;
import com.bd.scm.domain.dto.user.UserDto;
import com.bd.scm.domain.models.test.TestClass;
import com.bd.scm.domain.models.user.UserInfo;
import com.bd.scm.module.user.service.UserInfoService;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *  员工服务实现类
 *  User: _Cps
 *  Date: 2019.08.28 16:44
 */
@Service
@CacheConfig(cacheNames = {"treeUser"})
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements UserInfoService {

    @Autowired
    private UserInfoMapper userInfoMapper;

    @Override
    public IPage<UserInfo> getUserList(UserDto userDto){
        //Page<UserInfo> page = new Page<UserInfo>(userDto.getCurrent(),userDto.getPageSize());
        Page<UserInfo> page = new Page<UserInfo>(1,10);
        return userInfoMapper.getUserList(page,userDto);
    }

    @Override
    public IPage<UserInfo> userList(Page<UserInfo> page,UserDto userDto){
        return userInfoMapper.getUserList(page,userDto);
    }

    /**
     * 根据条件（部门ID和人员ID字符串）获取人员信息.
     *
     * @param userDto
     * @return
     */
    @Override
    public List<UserInfo> getUserListByParam(UserDto userDto) {
        return userInfoMapper.getUserListByParam(userDto);
    }

    @Override
    public UserInfo getUserInfoByUserNo(UserDto userDto) {
        return userInfoMapper.getUserInfoByUserNo(userDto);
    }
    /**
     * 根据条件（部门ID和人员ID字符串）获取人员信息.
     *
     * @param userDto
     * @return
     */
    @Override
    public List<UserInfo> getUserListByTree(UserDto userDto) {
        return userInfoMapper.getUserListByTree(userDto);
    }
}
